﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Zvezda.FSO2.DB;
using Telerik.WinControls.UI;

namespace FSO.Reports
{
    public partial class UserControlTypeOfActivitySelector : UserControl
    {
        public UserControlTypeOfActivitySelector()
        {
            InitializeComponent();
        }
        /// <summary>
        /// Загружает данные из БД
        /// </summary>
        private void UserControlTypeOfActivitySelector_Load(object sender, EventArgs e)
        {
            tableAdapterManager1.NSI_TYPE_OF_ACTIVITYTableAdapter.Fill(dataSetFSO1.NSI_TYPE_OF_ACTIVITY);
			radDropDownListTypeOfActivity.Items.Clear();
			foreach (DataSetFSO.NSI_TYPE_OF_ACTIVITYRow row in dataSetFSO1.NSI_TYPE_OF_ACTIVITY.Rows)
			{
				radDropDownListTypeOfActivity.Items.Add(new RadListDataItem() { Text = row.NAME, Value = row.ID });
			}
        }
        public bool IsNull
        {
            get
            {
                bool bReturn = true;
                if (radCheckBoxContractIsNull.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
                {
                    bReturn = false;
                }
                 return bReturn;
            }
        }
        /// <summary>
        /// Обрабатывает изменения состояния переключателя выбора значения
        /// </summary>
        private void radCheckBoxOrgIsNull_ToggleStateChanged(object sender, Telerik.WinControls.UI.StateChangedEventArgs args)
        {
            if (args.ToggleState == Telerik.WinControls.Enumerations.ToggleState.On)
            {
                radDropDownListTypeOfActivity.Enabled = true;
            }
            else
            {
                radDropDownListTypeOfActivity.Enabled = false;
            }
        }

        public string SelectedValue
        {
            get
            {
                return radDropDownListTypeOfActivity.SelectedItem.Value.ToString();
            }
        }
        public string SelectedText
        {
            get
            {
                return radDropDownListTypeOfActivity.SelectedItem.Text;
            }
        }
    }
}
